package router

import (
	"github.com/gin-gonic/gin"
	jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
	"tuowei.com/app/api/apis"
	"tuowei.com/common/middleware"
)

func init() {
	routerCheckRole = append(routerCheckRole, registerApiShoppingCartRouter)
}

// 需认证的路由代码
func registerApiShoppingCartRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	api := apis.ApiShoppingCart{}

	v1auth := v1.Group("/shopping/cart").Use(authMiddleware.MiddlewareFunc()).Use(middleware.CheckLogin)
	{
		//获取学生的购物车列表
		v1auth.POST("", api.GetPages)
		//新增商品到购物车
		v1auth.POST("/add", api.Insert)
		//修改购物车商品信息
		v1auth.POST("/update", api.Change)
		//删除购物车里面的商品
		v1auth.POST("/delete", api.Delete)

	}
}
